/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.srcptit.trainning.thompv.btvn2;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
 *
 * @author SONY
 */
public class Bai10 {
    static boolean ngto(int n)
    {
        if(n<2) return false;
        for(int i=2;i<=(int)Math.sqrt(n);i++)
        if(n%i==0) return false;
        return true;
    }
    public static void main(String[] args)
    {
        try
        {
            BufferedReader f=new BufferedReader(new FileReader("Bai10_tuan2.txt"));
            String s=f.readLine();
            if(s.length()<1) throw new Exception("File rong!");
            String s1[]=s.split(" ");
            int a[]=new int[1000],t=1,dem=0;
            for(int i=0;i<s1.length;i++)
            {
                try
                {
                     a[t]=Integer.parseInt(s1[i]);
                     t++;
                }
                catch (Exception e)
                {
                    System.out.println("ko the ep kieu do file chua cac chu"); break;
                }
            }
            for(int i=1;i<t;i++)
                  if(!ngto(a[i])) a[i]=0;
            for(int i=1;i<t;i++)
                for(int j=i+1;j<t;j++)
                    if(a[i]!=0)
                        if(a[i]==a[j])
                            a[j]=0;
            for(int i=1;i<t;i++)
                if(a[i]!=0) dem++;
            System.out.println("Co "+dem+" so ngto khac nhau trong file");
        }
        catch (Exception e)
        {
            System.out.println("Not found!"+e);
        }
    }
}
